${page.setTitle("push-center| GOPS")}
<div class="body-pla-content">
	<div class="s-table-wapper">
		 
		<form action="">
		<table class="s-table">
			<tr>
				<td>
					渠道：
				</td>
				<td>
					<input type="text" name="appChannel"  id="appChannel" value="${appChannel!}"/>
				</td>
				<td><input id="btnSearch"  type="button" value="查询"  class="l-button"/>
				<input type="reset" value="清空" class="l-button l-button-reset"/> 
				</td>	
			</tr>
		</table>
		</form>
		 
	</div>
	<div id="maingrid" style="margin:0; padding:0"></div>
	<div style="display:none;">
</div>



<script type="text/javascript">
$(function ()
        { 
            $("#select2").ligerComboBox({
                width : 400,
                cancelable: true
            });
        });
        

var grid;
$(function () {
     var columns= [
       				{ display: 'ID', name: 'id', width: 120},
       				{ display: '生成时间', name: 'gmtCreated', width: 150,type:"datetime2"},
       				{ display: '修改时间', name: 'gmtModified', width: 150,type:"datetime2"},
       				{ display: '备注', name: 'memo',width:180},
              	    { header: '内容', name: 'text' , width: 120,render: function (item){
		   				return "<a title='"+item.packetJson+"'>"+item.packetJson+"</a>";
		  				}
  					},
       				{ display: 'appId', name: 'appId', width: 100},
       				{ display: '渠道', name: 'appChannel', width: 50},
       				{ display: '失败次数', name: 'failCount', width: 50},
       				{ display: '首次入队成功', name: 'firstOfferStatus', width: 50,render:epay_enum.addqueue.result.render}
                   ];
             var toolbar={
				items: [
							 {text: '更新状态', click: toolbarBtnItemClick, icon:'refresh'},
							  { line:true }
						]
    		 };
	grid = $("#maingrid").ligerGrid({
						columns:columns,
						checkbox:false,
						enabledSort:false,
						pageSize:10,
						toolbar:toolbar,
						dataAction:'server',
						root:'rows',
						record :'total',
						pageParmName :'page',
						pagesizeParmName :'pageSize',
						width: '100%',
						height:'90%',
						url:'${appServer}/message/query.json',
						parms : $("form").serializeArray(),
						method:'get',
						onSuccess:function(data, grid){
							if(data.hasError){
								$.ligerDialog.error(data.message);
							}
						}
					});
     	
     $("#pageloading").hide();
     
      $("#btnSearch").click(function(){
		 search();
	 });
});


function toolbarBtnItemClick(item) {
	var url= null;
    switch (item.icon) {
        
        case "refresh":
            jQuery.ligerDialog.confirm('这个操作会把所有数据状态从入队成功置为入队失败,以便定时任务抓取数据重新发送。<br/>目的是为了使尚未发送成功由于服务器故障而没有发送的消息得以重新获得推送机会，<b>但是这样有可能造成消息重新推送。</b><br/>确定更新吗?', function (confirm) {
                if (confirm){
                	  $.ajax({
              	        url: "${appServer}/message/updatestatus.json",   
              	        type: "get",
              	        success: function(result) {
              	        	if(result.hasError) {
              					$.ligerDialog.error(result.message);
              	        	}else{
              	        		$.ligerDialog.success(result.message);
              	        		window.search();
              	        	}
              	        }
              	    });
                 }
            });
            break;
    }
}


function search(){
	 var appKey=$("#appKey");
 	 grid.setOptions( {
 		  		url: '${appServer}/message/query.json',
 		  		pageSize:10,
 		  		page:1,
 		  		content:'content',
 		  		recieveId:'receiveId',
 		  		dataAction:'server',
                parms : $("form").serializeArray()
         });
}

</script>
